import request from "@/utils/request";

export function page(data) {
  return request({
    url: "/sys/v1/menu/page",
    method: "get",
    params: data
  });
}

export function save(data) {
  return request({
    url: "/sys/v1/menu/save",
    method: "post",
    data
  });
}

export function update(data) {
  return request({
    url: "/sys/v1/menu/update",
    method: "post",
    data
  });
}

export function deleteId(id) {
  return request({
    url: "/sys/v1/menu/delete/" + id,
    method: "get"
  });
}

export function check(id) {
  return request({
    url: "/sys/v1/menu/get/" + id,
    method: "get"
  });
}
// 获取全部的权限树;
export function queryTreeList() {
  return request({
    url: "/sys/v1/menu/queryTreeList",
    method: "get"
  });
}
// 获取系统所有菜单
export function menuList() {
  return request({
    url: "/sys/v1/menu/list",
    method: "get"
  });
}

// 保存角色授权
export function saveRolePermission(data) {
  return request({
    url: "/sys/v1/menu/saveRolePermission",
    method: "POST",
    data
  });
}

// 查询角色授权
export function queryRolePermission(data) {
  return request({
    url: "/sys/v1/menu/queryRolePermission",
    method: "GET",
    params: data
  });
}

// 查询用户拥有的菜单权限和按钮权限
export function getUserPermissionByToken() {
  return request({
    url: "/sys/v1/menu/getUserPermissionByToken",
    method: "GET"
  });
}
